<script setup>
import {ref} from "vue";
import jumpHelper from "@/js/pageJumper";


const mode = ref(0)
const topTabbarJump = (newIndex)=>{
  mode.value = newIndex;
  switch (newIndex){
    case 0: jumpHelper.jumpToManageUser();
      break;
    case 1: jumpHelper.jumpToManageOffer()
      break;
    case 2: jumpHelper.jumpToManagerMessage()
      break;
  }
}
</script>

<template>
  <div class="all-container">
    <div class="appearing-container">
      <!--顶部导航栏-->
      <div class="top-tabbar">
        <p @click="topTabbarJump(0)" :class="mode === 0 ? 'chosen-top-tabbar' : 'unchosen-top-tabbar'">用户管理</p>|
        <p @click="topTabbarJump(1)" :class="mode === 1 ? 'chosen-top-tabbar' : 'unchosen-top-tabbar'">任务管理</p>|
        <p @click="topTabbarJump(2)" :class="mode === 2 ? 'chosen-top-tabbar' : 'unchosen-top-tabbar'">消息</p>
      </div>
      <img @click="jumpHelper.jumpToCustomerNewTask()" class="back-btn" src="@/assets/back.png">
      <!--底部路由-->
      <router-view class="grandchildren-router-view"></router-view>
    </div>
  </div>
</template>

<style scoped>
.back-btn{
  position: fixed;
  left: 12px;
  top: 8px;
  width: 36px;
  user-select: none;
  cursor: pointer;
}
.all-container{
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}
.top-tabbar{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  justify-content: center;
  display: flex;
  align-items: center;
  font-size: 18px;
  color: #999;
  user-select: none;
}
.top-tabbar p{
  white-space: nowrap;
  margin: 0 12px 0 12px;
}
.chosen-top-tabbar{
  color: #333;
  transition: .4s;
  position: relative;
}
.chosen-top-tabbar:after{
  content: "";
  width: 24px;
  height: 4px;
  background-color: #9994e1;
  position: absolute;
  border-radius: 2px;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  transition: .4s;
}
.unchosen-top-tabbar{
  color: #999;
  cursor: pointer;
  transition: .4s;
}
.grandchildren-router-view{
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  top: 56px;
}
</style>